package com.han.design;

/**
 * @author v-taohuang
 * @date 下午11:09 2020/2/23
 */
public class InnerFactory extends AbstractStrategyFactory {

    @Override
    public IPayMent createPay(int channel) {

        super.prePay(channel);
        if (channel == PayEnum.ALI.channel) {
            return new AliPay();
        }
        else if (channel == PayEnum.WECHAT.channel) {
            return new WechatPay();
        }
        return null;
    }

    @Override
    public IPayOrder createPayOrder(int channel) {

        if (channel == PayEnum.ALI.channel) {
            return new AliOrder();
        }
        else if (channel == PayEnum.WECHAT.channel) {
            return new WechatOrder();
        }
        return null;
    }
}
